//
//  SDEGORefreshTableHeaderView.h
//  SKinDiary
//
//  Created by pcyang on 16/6/26.
//  Copyright © 2016年 tencent. All rights reserved.
//

#import <Foundation/Foundation.h>

#import <QuartzCore/QuartzCore.h>

typedef enum {
    EGOOPullRefreshPulling = 0,
    EGOOPullRefreshNormal,
    EGOOPullRefreshLoading,
    EGOOPullRefreshForceLoading,
} EGOPullRefreshState;

@protocol SDEGORefreshTableHeaderDelegate;

#define SDEGORefreshTableHeaderViewHeight 40.0f

@interface SDEGORefreshTableHeaderView : UIView {
    
    //	id _delegate;
    EGOPullRefreshState _state;
    
    //	CALayer *_arrowImage;
    //	UIActivityIndicatorView *_activityView;
    
    BOOL _isTriggerByDrag;
    NSDate *_lastUpdateDate;
}

@property(nonatomic, weak) NSObject<SDEGORefreshTableHeaderDelegate> *delegate;
@property(nonatomic, assign) BOOL isTriggerByDrag;
@property(nonatomic, strong) NSDate *lastUpdateDate;
@property(nonatomic, strong) UILabel *lastUpdatedLabel;
@property(nonatomic, strong) UILabel *statusLabel;

- (void)refreshLastUpdatedDate;
- (void)egoRefreshScrollViewDidScroll:(UIScrollView *)scrollView;
- (void)egoRefreshScrollViewDidEndDragging:(UIScrollView *)scrollView;
- (void)egoRefreshScrollViewDataSourceDidFinishedLoading:(UIScrollView *)scrollView;
- (void)forceLoading:(UIScrollView *)scrollView;

- (void)refresh;

- (void)forceLoading:(UIScrollView *)scrollView animate:(BOOL)animate;
@end
@protocol SDEGORefreshTableHeaderDelegate
- (void)egoRefreshTableHeaderDidTriggerRefresh:(SDEGORefreshTableHeaderView *)view;
- (BOOL)egoRefreshTableHeaderDataSourceIsLoading:(SDEGORefreshTableHeaderView *)view;
- (NSString *)egoRefreshTableHeaderTitle:(SDEGORefreshTableHeaderView *)view state:(EGOPullRefreshState)aState;
@optional
- (NSDate *)egoRefreshTableHeaderDataSourceLastUpdated:(SDEGORefreshTableHeaderView *)view;

@end

